package cn.tedu.classx;

public class TeacherDemo {
    public static void main(String[] args) {
        //创建Teacher对象
        //无参构造
//        Teacher t1 = new Teacher();
//        System.out.println(t1.name+","+t1.age);
        //有参构造
//        Teacher t2 = new Teacher("李四");
//        System.out.println(t2.name+","+t2.age);

        //调用teach方法
//        t1.teach();

        //匿名对象
       // System.out.println(new Teacher().name);
//        new Teacher().name = "李四";//0x001
//        System.out.println(new Teacher().name);//张三 0x002

        //通过匿名对象来调用方法
//        new Teacher().teach();

       Teacher t3 =  new Teacher();
       t3.setTeacher(new Teacher());//new Teacher() -->0x001
         t3.getTeacher();
    }
}
